<?php
//debug($configs);exit;
?>
<div class='right_table'>
<?php echo $form->create('News', array(
	'url'	=>	
	$params + array(
		'controller'	=>	$this->params['controller'],	
		'action'		=>	'update_priority'
	)
));?>
<table class='list form_background' cellspacing='1' cellpadding='0' id='room_type_list'>
	<tr>
		<th width='23'><a><?php echo __("#"); ?></a></th>
		<th><?php echo $paginator->sort(__("Tiêu đề", true), "News.title"); ?></th>
		<th width='200'><?php echo $paginator->sort(__("Danh mục", true), 'I18nCategory.name'); ?></th>
		<th width='120'><?php echo $paginator->sort(__("Kích hoạt", true), 'News.is_published'); ?></th>
		<th width='160'><?php echo $paginator->sort(__("Ngày xuất bản", true), 'News.news_date'); ?></th>
		<?php if (isset($configs['News']['order']) && $configs['News']['order']['orderable']):?>
		<th width='100'><?php echo $paginator->sort(__("Độ ưu tiên", true), "News.priority"); ?></th>
		<?php endif;?>
		<th width='150'><a><?php echo __("Chức năng"); ?></a></th>
	</tr>
	<?php if(!$pages):?>
	<tr class="row1">
		<td colspan="5" align="center" style="font-weight:bold"><?php echo __("Chưa có dữ liệu.");?></td>
	</tr>
	<?php
	endif;
		$i=0;
		$class = 'altrow';
		$room_type_list = array();
		foreach ($pages as $page):
			$class = $class == "" ? "class='altrow'" : "";
			$page_id = $page['News']['id'];
			//$class = "row".($i%2)?"0":"1";
			$i++;
	?>
	<tr <?php echo $class?> page_id="<?php echo $page_id?>">
		<td><?php echo $page_id?></td>
		<td>
			<span class='field_name'><?php echo $page['News']['title']?></span><br/>
			<span class='alias'><?php echo $page['News']['alias']?></span>
			<?php if ($view_options['details']['show_image']):
			$image = $page['News']['image'];
			
			$url = $configs['News']['image']['uri'].$image;
			if ($view_options['thumbnail']['has_thumbnail']) {
				$image = $html->getThumbnailName($image);
				$url = $configs['News']['thumbnail']['uri'].$image;
			}
			?>
			<br/>
			<img src="<?php echo $html->url('/'.$url);?>"/>
			<?php endif;?>
		</td>
		<td align="center">
			<span class='field_category'><?php echo $page['I18nCategory']['name']?></span>
		</td>
		<td align='center'>
			<?php echo ($page['News']['is_published']) ? "Có" : "Không"?>
		</td>
		<td align='center'>
			<?php echo date("Y-m-d H:i:s", strtotime($page['News']['news_date']))?>
		</td>
		<?php if (isset($configs['News']['order']) && $configs['News']['order']['orderable']):?>
		<td align="center"><input class='priority' size='4' type='text' name="priority[<?php echo $page['News']['id']?>]" value='<?php echo $page['News']['priority']?>'/></td>
		<?php endif;?>
		<td class='actions'>
			<div class="sub_menu_list">
				<div class="cssdropdown">
					<ul>
						<li class="headlink">
							<a href="#"><?php __("Chức năng")?></a>
							<ul rel='<?php echo $page_id?>'>
 							 <li><a class="list_03 edit_page_link" page_id="<?php echo $page_id?>" href="<?php echo $html->url($params + array('controller'=>$this->params['controller'], 'action'=>'edit', $page_id))?>"><?php __("Chỉnh sửa");?></a></li>
							 <li><a class="list_04 delete_page" href="<?php echo $html->url($params + array('controller'=>$this->params['controller'], 'action'=>'delete', $page_id))?>" onclick="return confirm('<?php __("Bạn có thật sự muốn xóa trang này?")?>')"><?php __("Xóa");?></a></li>
							</ul>
						</li>
					</ul>
				</div>
			</div>
		</td>
	</tr>
	<?php endforeach;?>
	<tr class='list_footer'>
		<td colspan='5'>
			<?php echo $this->element('pagination/pagination', array('model' => 'News'));?>
		</td>
		<?php if (isset($configs['News']['order']) && $configs['News']['order']['orderable']):?>
		<td align="center">
			<input class='button' type='submit' value='<?php echo __("Cập nhật");?>'/>
		</td>
		<?php endif;?>
		<td></td>
	</tr>
</table>
<?php echo $form->end();?>
</div>